/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package eit.dao.impl;

import eit.dao.ProjectDAO;
import eit.dao.rowmapper.ProjectRowMapper;
import eit.model.Project;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 *
 * @author acoustic
 */

@Repository
public class ProjectDAOImpl implements ProjectDAO
{
	@Autowired
	JdbcTemplate projectJDBCTemplate ;

	@Override
	public Project getProjectByIssueID(int _issueID)
	{
		String sqlQuery = "SELECT P.* "
				+ "FROM project P "
				+ "INNER JOIN issue I on I.ProjectID = P.ID "
				+ "WHERE I.ID = ?" ;
		
		Project returnProject = 
				(Project)projectJDBCTemplate.queryForObject(sqlQuery, new Object[]{_issueID},  new ProjectRowMapper()) ;
		
		return returnProject ;
	}

	@Override
	public void insert(Project _Item)
	{
		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
	}

	@Override
	public void update(Project _Item)
	{
		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
	}

	@Override
	public void delete(Project _Item)
	{
		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
	}

	@Override
	public Project get(int _ID)
	{
		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
	}

	@Override
	public ArrayList<Project> getAll()
	{
		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
	}
	
	
	
}
